package com.gym.core.number;

import org.apache.http.annotation.ThreadSafe;

/**
 * 
 * @author wangxinchun1988@163.com
 *
 * 2016-6-13 下午3:18:00
 */
@ThreadSafe
public final class SafeIntegerHolder {
	private volatile int value;

	public SafeIntegerHolder() {
	}

	public SafeIntegerHolder(int value) {
		this.value = value;
	}

	public synchronized int  inc() {
		return value = value + 1;
	}

	public synchronized int dec() {
		return value = value - 1;
	}

	public synchronized int getValue() {
		return value;
	}

	public synchronized void setValue(int value) {
		this.value = value;
	}

}
